package rim;

import java.util.ArrayList;
import java.util.List;



import datatypes.r2.basic.CD;
import datatypes.r2.basic.CS;
import datatypes.r2.basic.ED;
import datatypes.r2.basic.EN;
import datatypes.r2.basic.II;
import datatypes.r2.basic.TEL;
import datatypes.r2.collectionsofquantities.IVL;
import datatypes.r2.foundation.COLL;
import datatypes.r2.foundation.DSET;
import datatypes.r2.quantities.PQ;
import datatypes.r2.quantities.TS;

/**
 * Definition of Entity:
 * 
 * A physical thing, group of physical things or an organization capable of
 * participating in Acts while in a role.
 * 
 * 实体的定义：
 * 
 * 物理的东西，一组物理事物或一个组织能够参与，而在角色行为。
 * 
 * 
 * UsageNotes:
 * 
 * An entity is a physical object that has, had or will have existence. The only
 * exception to this is Organization, which while not having a physical
 * presence, fulfills the other characteristics of an Entity. Entity stipulates
 * the thing itself, not the Roles it may play: the Role of Patient, e.g., is
 * played by the Person Entity.
 * 
 * 一个实体，是一个物理对象，有或将有存在。唯一的例外是组织，而不是一个物理存在，满足实体等特点。实体规定的事情本身，而不是它可能发挥的作用：对病人的角色，
 * 例如，由Person实体发挥。
 * 
 * 
 * Examples:
 * 
 * Living subjects (including human beings), organizations, materials, places
 * and their specializations.
 * 
 * 生活主题（包括人类），组织，物资，地方和他们的专长。
 * 
 * @author Obama
 * 
 */
public class Entity extends InfrastructureRoot {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private CS classCode;

	/**
	 * Definition: A code specifying whether the Entity object represents a
	 * universal (KIND) vs. a particular (INSTANCE).
	 * 
	 * A码，指定实体对象是否代表了普遍的（种）与一个特定的（实例）。
	 * 
	 * 
	 * Rationale:
	 * 
	 * An Entity may at times represent information concerning a specific
	 * instance (the most common) or a general type of Entity.
	 * 
	 * 一个实体可能代表在关于特定实例（最常见）或实体的一般类型的信息。
	 * 
	 * 
	 * Examples:
	 * 
	 * One human being (instance); or citizens of Indianapolis (kind)
	 * 
	 * 一个人（实例）;或公民的印第安纳波利斯（种）
	 */
	private CS determinerCode;
	/**
	 * Definition: A unique identifier for the Entity.
	 * 
	 * 为实体的唯一标识符。
	 * 
	 * 
	 * UsageNotes:
	 * 
	 * An instance identifier is a unique identifier, not a classifier. For
	 * Materials, serial numbers assigned by specific manufacturers, catalog
	 * numbers of specific distributors, or inventory numbers issued by owners,
	 * may better be represented by the Role.id, which allows a more clear
	 * expression of the fact that such a code is assigned by a specific party
	 * associated with that material.
	 * 
	 * 一个实例标识符是一个唯一的标识符，而不是一个分类。材料，由特定厂商，特定的分销商的产品目录号，或由业主发出的存货数量分配的序号，可以更好地代表，
	 * 可以更清楚地表达了这样的代码是由分配由Role.id该材料的具体方关联。
	 * 
	 * 
	 * Rationale:
	 * 
	 * Successful communication only requires that an entity have a single
	 * identifier assigned to it. However, as different systems maintain
	 * different databases, there may be different instance identifiers assigned
	 * by different systems.
	 * 
	 * 成功的沟通只需要一个实体有一个单一的标识符分配给它的。然而，由于不同的系统维护不同的数据库，有可能是不同的实例分配不同的系统标识符。
	 */
	private DSET<II> id;
	/**
	 * Definition: The specific kind of Entity to which an Entity-instance
	 * belongs.
	 * 
	 * 属于特定种类的实体，一个实体实例。
	 * 
	 * 
	 * UsageNotes:
	 * 
	 * For each Entity, the value for this attribute is drawn from one of
	 * several coding systems as suggested by the Entity.classCode, such as
	 * living subject (animal and plant taxonomies), chemical substance (e.g.,
	 * IUPAC code), organization (e.g., CMS provider number), etc. It is
	 * possible that Entity.code may be so fine grained that it represents a
	 * single instance. An example is the CDC vaccine manufacturer code, modeled
	 * as a concept vocabulary, when in fact each concept refers to a single
	 * instance. The boundary cases distinguishing codes and identifiers are
	 * controversial: this specification allows a certain amount of flexibility.
	 * 
	 * 对于每个实体，这个属性的值是来自几个编码系统之一建议由Entity.classCode，如生活主题（动物和植物分类学），化学物质（例如，
	 * 国际化联代码），组织（如CMS供应商的数量），等它可能Entity.code可能细粒，它代表一个单独的实例。一个例子是CDC的疫苗生产商代码，
	 * 仿照作为一个概念的词汇，其实每一个概念，是指一个实例。有争议的边界的情况下，识别代码和标识：这个规范允许一定的灵活性。
	 * 
	 * 
	 * Examples:
	 * 
	 * A medical building, a Doberman Pinscher, a blood collection tube, a
	 * tissue biopsy.
	 * 
	 * 医疗建设，杜宾，血液收集管，一个组织活检。
	 */
	private CD code;
	/**
	 * Definition: A physical quantity specifying the amount of the physical
	 * thing represented by the Entity object, either as a count of the members
	 * of a group, or as some other physical quantity. Describes the amount of
	 * the Entity, irrespective of potential Participations of the Entity as a
	 * whole or in parts. In order to explicitly identify a group of like
	 * entities, a static model design should constrain the PQ data type of this
	 * attribute to INT, thus providing a count of the entities in the group.
	 * 
	 * 物理量指定量的实体对象所代表的物理的东西，无论是作为一个组成员的罪名，或其他一些物理量。描述实体的金额，不论实体作为一个整体或部分的潜在的参与。
	 * 为了明确地确定一批像实体，静态模型设计应该限制这个属性PQ数据类型为INT，从而提供了一个组中的各实体的计数。
	 * 
	 * 
	 * UsageConstraint:
	 * 
	 * The unit of quantity should make sense for the Entity.code and
	 * Material.formCode attributes where specified. For example,
	 * "10cm of tubing" is fine, while "10cm of cow" is not.
	 * 
	 * 数量单位应特别指明的Entity.code和Material.formCode属性的意义。例如，“油管10厘米”是罚款，而“牛10厘米”不是。
	 * 
	 * 
	 * UsageConstraint:
	 * 
	 * Entity quantity should only be used for specifically identified Entities
	 * (such as the contents of beer keg #XP27-35) or in cases where the
	 * quantity is an intrinsic part of the specification of the entity (such as
	 * a specific portion of phosgene).
	 * 
	 * 实体的数量应该只用于具体确定实体（如啤酒桶＃XP27-35的内容），或在案件的数量是一个实体的规范（如光气的一个特定部分）的内在组成部分。
	 * 
	 * 
	 * UsageNotes:
	 * 
	 * Just as the name of a Person may change, or even its gender, the quantity
	 * of any entity can be subject to change too. With material and bulk living
	 * subjects it is possible for the quantity to gradually diminish, or, for
	 * such an Entity to be portioned out into smaller amounts of the same kind
	 * of Entity (e.g. aliquoting in a laboratory or distributing a production
	 * lot in smaller amounts.) In the case of this portioning out of an amount
	 * into smaller amounts, the initial Entity instance of the large amount may
	 * cease to exist, yet the portions may still be traceable to the initial
	 * Entity of the large amount (as in patient for a specimen aliquot or lot
	 * for a vaccine).
	 * 
	 * Specifying Entity.quantity is often not necessary as one can specify
	 * quantity in relation to other Entities (Role.quantity), participations
	 * (Participation.quantity), and and in Acts which consume or produce such
	 * Entity (e.g. SubstanceAdministration.doseQuantity, Supply.quantity).
	 * 
	 * 正如一个人的名字可能会改变，甚至其性别，任何实体的数量可以改变太多。材料和散装的生活主题，这是可能的数量逐渐减少，或者，
	 * 对于这样一个实体必须分给少量的同类实体
	 * （如aliquoting在实验室或分发了少量的生产批号。大量的初始实体实例）在分份数额较小金额的情况下，可能不复存在
	 * ，但仍可能溯源到大量的初始实体的部分（如病人标本等分或大量疫苗）。
	 * 
	 * 指定Entity.quantity是往往没有必要，可以指定数量关系的其他实体（Role.quantity），参与（Participation.
	 * quantity ），并在消耗或产生这样的实体的行为（，如SubstanceAdministration.doseQuantity，Supply.
	 * quantity ）。
	 * 
	 * 
	 * Examples:
	 * 
	 * 1 human being, 2 cats, 500 cows, 20 mL of blood, 1 kg of yeast, 154 mmol
	 * of sodium chloride.
	 * 
	 * 1人，2只猫，500头奶牛，20毫升的血液，酵母1公斤，154毫摩尔氯化钠。
	 * 
	 * 
	 * FormalConstraint:
	 * 
	 * Quantity must be an extensive amount, that is, a count number or an
	 * additive quantity, such as mass (1 kg), volume (1 L), amount of substance
	 * (1 mol), or another quantity of a kind suitable to describe an amount
	 * (catalytic activity).
	 * 
	 * 数量必须是广泛的数额，即计数的数量或添加剂量，如质量（1公斤），体积（1升），（1摩尔）物质的量，数量或另一种适合来形容，金额（催化活性）。
	 * 
	 * 
	 * OpenIssue:
	 * 
	 * Specifying quantity in terms of an arbitrary, procedure-defined kind of
	 * quantity (e.g., tuberculin-units) may not allow to reliably interpret
	 * such quantity statement.
	 * 
	 * 指定在任意一个程序定义的数量（例如，结核菌素单位）的数量可能不会允许可靠地解释这种数量的报表。
	 */
	private PQ quantity;
	/**
	 * Definition: A non-unique textual identifier or moniker for the Entity.
	 * 
	 * 一个非唯一的文字标识或绰号为实体。
	 * 
	 * 
	 * Rationale:
	 * 
	 * Most entities have a commonly used name that can be used to differentiate
	 * them from other Entities, but that does not provide a necessarily unique
	 * identifier.
	 * 
	 * 大多数实体有一个常用的名称，可以用来区别于其他实体，但并不提供了一定的唯一标识符。
	 * 
	 * 
	 * Examples:
	 * 
	 * Proper names, nicknames, legal names of persons, places or things.
	 * 
	 * 恰当的名字，绰号，法律的人，地方或事物的名称。
	 */
	private COLL<EN> name;
	/**
	 * Definition: A textual or multimedia depiction of the Entity.
	 * 
	 * 一个实体的文本或多媒体的写照。
	 * 
	 * 
	 * UsageNotes:
	 * 
	 * The content of the description is not considered part of the functional
	 * information communicated between systems. Descriptions are meant to be
	 * shown to interested human individuals. All information relevant for
	 * automated functions must be communicated using the proper attributes and
	 * associated objects.
	 * 
	 * 描述的内容不被视为部分功能的信息系统之间的沟通。说明是为了显示感兴趣的人类个体。自动化功能相关的所有信息必须使用正确的属性和相关联的对象传达。
	 * 
	 * 
	 * Rationale:
	 * 
	 * Names and descriptions of entities are typically more meaningful to human
	 * viewers than numeric, mnemonic or abbreviated code values. The
	 * description allows for additional context about the entity to be conveyed
	 * to human viewers without affecting the functional components of the
	 * message.
	 * 
	 * 实体的名称和描述通常是更有意义的数字，记忆或缩写代码值比人类观众。说明允许额外的上下文要传达对人类观众，而不影响消息的功能部件的实体。
	 */
	private ED desc;
	/**
	 * Definition: A value representing whether the information associated with
	 * an Entity is currently active or inactive for the purpose of
	 * participation in acts.
	 * 
	 * 一个值，表示是否与实体相关的信息，是目前活跃或不活跃的参与行为的目的。
	 * 
	 * 
	 * UsageNotes:
	 * 
	 * This attribute was defined in the original RIM as repeating, owing to the
	 * presence of nested states in the state machines. In actual practice,
	 * however, there is never a need to communicate more than a single status
	 * value. Therefore, committees are advised to constrain this attribute to a
	 * maximum cardinality of 1 in all message designs.
	 * 
	 * 这个属性被定义在原RIM重复，由于存在嵌套状态机状态。然而，在实际操作中，有没有需要沟通超过一个状态值。因此，
	 * 委员会建议在所有的消息设计的最大基数为1来约束这个属性。
	 */
	private CS statusCode;
	/**
	 * Definition: An interval of time specifying the period in which the Entity
	 * physically existed.
	 * 
	 * 指定的时间间隔期间在实体的物理存在。
	 * 
	 * 
	 * 
	 * UsageNotes:
	 * 
	 * Physical entities have specified periods in which they exist. Equipment
	 * is manufactured, placed in service, retired and salvaged. The relevance
	 * of this attribute is in planning, availability and retrospective
	 * analysis. This period may represent past, present or future time periods.
	 * 
	 * 物理实体指定了其存在的时期。设备制造，在服务上，退休和打捞。这个属性的相关规划，可用性和回顾性分析。这个时期可能代表过去，现在或未来的时间段。
	 * 
	 * 
	 * Examples:
	 * 
	 * ManufactureDate / DisposalDate
	 * 
	 * 生产日期/处置日期
	 */
	private IVL<TS> existenceTime;
	/**
	 * Definition: A telecommunication address for the Entity.
	 * 
	 * 通讯地址为实体。
	 */
	private COLL<TEL> telecom;
	/**
	 * Definition: The type of hazard or threat associated with the Entity.
	 * 
	 * 与实体相关的危险或威胁的类型。
	 * 
	 * 
	 * Examples:
	 * 
	 * Petrochemical or organic chemicals are highly flammable agents that pose
	 * an increased risk of fire under certain conditions. Entities with either
	 * natural or introduced radioactive character pose a risk to those handling
	 * them. Entities comprising specimens from diseased individuals pose an
	 * increased risk of infection to those handling them. Persons or animals of
	 * irascible temperament may prove to be a risk to healthcare personnel.
	 * 
	 * 石化或有机化工原料，是构成火灾风险增加，在一定条件下的高度易燃的代理商。与自然或引入放射性字符实体构成的风险处理。
	 * 包括从患病个体标本的实体构成感染的风险增加处理。暴躁气质的人或动物，可能被证明是一个医护人员的风险。
	 */
	private DSET<CD> riskCode;
	/**
	 * Definition: A value representing special handling requirements for the
	 * Entity.
	 * 
	 * 一个代表实体的特殊处理要求的价值。
	 * 
	 * 
	 * UsageNotes:
	 * 
	 * This attribute is used to describe required special handling.
	 * 
	 * 这个属性是用来描述所需的特殊处理。
	 * 
	 * 
	 * Examples:
	 * 
	 * Keep at room temperature; Keep frozen below 0 C; Keep in a dry
	 * environment; Keep upright.
	 * 
	 * 保持房间温度保持0℃以下冻结;保持干燥的环境中，保持直立。
	 * 
	 * 
	 */
	private DSET<CD> handlingCode;

	List<CommunicationFunction> communicationFunction = new ArrayList<CommunicationFunction>();

	List<Role> playedRole = new ArrayList<Role>();

	List<Role> scopedRole = new ArrayList<Role>();

	List<LanguageCommunication> languageCommunication = new ArrayList<LanguageCommunication>();

	public CS getClassCode() {
		return classCode;
	}

	public void setClassCode(CS classCode) {
		this.classCode = classCode;
	}

	public CS getDeterminerCode() {
		return determinerCode;
	}

	public void setDeterminerCode(CS determinerCode) {
		this.determinerCode = determinerCode;
	}

	public DSET<II> getId() {
		return id;
	}

	public void setId(DSET<II> id) {
		this.id = id;
	}

	public CD getCode() {
		return code;
	}

	public void setCode(CD code) {
		this.code = code;
	}

	public PQ getQuantity() {
		return quantity;
	}

	public void setQuantity(PQ quantity) {
		this.quantity = quantity;
	}

	public COLL<EN> getName() {
		return name;
	}

	public void setName(COLL<EN> name) {
		this.name = name;
	}

	public ED getDesc() {
		return desc;
	}

	public void setDesc(ED desc) {
		this.desc = desc;
	}

	public CS getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(CS statusCode) {
		this.statusCode = statusCode;
	}

	public IVL<TS> getExistenceTime() {
		return existenceTime;
	}

	public void setExistenceTime(IVL<TS> existenceTime) {
		this.existenceTime = existenceTime;
	}

	public COLL<TEL> getTelecom() {
		return telecom;
	}

	public void setTelecom(COLL<TEL> telecom) {
		this.telecom = telecom;
	}

	public DSET<CD> getRiskCode() {
		return riskCode;
	}

	public void setRiskCode(DSET<CD> riskCode) {
		this.riskCode = riskCode;
	}

	public DSET<CD> getHandlingCode() {
		return handlingCode;
	}

	public void setHandlingCode(DSET<CD> handlingCode) {
		this.handlingCode = handlingCode;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
